package com.ruoyi.supplier.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supplier.mapper.TbProductSpecItemMapper;
import com.ruoyi.supplier.domain.TbProductSpecItem;
import com.ruoyi.supplier.service.ITbProductSpecItemService;

/**
 * 商品规格明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-02-20
 */
@Service
public class TbProductSpecItemServiceImpl implements ITbProductSpecItemService 
{
    @Autowired
    private TbProductSpecItemMapper tbProductSpecItemMapper;

    /**
     * 查询商品规格明细
     * 
     * @param id 商品规格明细ID
     * @return 商品规格明细
     */
    @Override
    public TbProductSpecItem selectTbProductSpecItemById(Long id)
    {
        return tbProductSpecItemMapper.selectTbProductSpecItemById(id);
    }

    /**
     * 查询商品规格明细列表
     * 
     * @param tbProductSpecItem 商品规格明细
     * @return 商品规格明细
     */
    @Override
    public List<TbProductSpecItem> selectTbProductSpecItemList(TbProductSpecItem tbProductSpecItem)
    {
        return tbProductSpecItemMapper.selectTbProductSpecItemList(tbProductSpecItem);
    }

    @Override
    public List<TbProductSpecItem> selectTbProductSpecItemByTypeId(Long typeId) {
        return tbProductSpecItemMapper.selectTbProductSpecItemByTypeId(typeId);
    }

    /**
     * 新增商品规格明细
     * 
     * @param tbProductSpecItem 商品规格明细
     * @return 结果
     */
    @Override
    public int insertTbProductSpecItem(TbProductSpecItem tbProductSpecItem)
    {
        tbProductSpecItem.setCreateTime(DateUtils.getNowDate());
        tbProductSpecItem.setCreateBy(SecurityUtils.getUsername());
        return tbProductSpecItemMapper.insertTbProductSpecItem(tbProductSpecItem);
    }

    /**
     * 修改商品规格明细
     * 
     * @param tbProductSpecItem 商品规格明细
     * @return 结果
     */
    @Override
    public int updateTbProductSpecItem(TbProductSpecItem tbProductSpecItem)
    {
        tbProductSpecItem.setUpdateTime(DateUtils.getNowDate());
        tbProductSpecItem.setUpdateBy(SecurityUtils.getUsername());
        return tbProductSpecItemMapper.updateTbProductSpecItem(tbProductSpecItem);
    }

    /**
     * 批量删除商品规格明细
     * 
     * @param ids 需要删除的商品规格明细ID
     * @return 结果
     */
    @Override
    public int deleteTbProductSpecItemByIds(Long[] ids)
    {
        return tbProductSpecItemMapper.deleteTbProductSpecItemByIds(ids);
    }

    /**
     * 删除商品规格明细信息
     * 
     * @param id 商品规格明细ID
     * @return 结果
     */
    @Override
    public int deleteTbProductSpecItemById(Long id)
    {
        return tbProductSpecItemMapper.deleteTbProductSpecItemById(id);
    }
}
